import os
import subprocess

def work():
    base_dir = os.path.dirname(os.path.abspath(__file__)) + "/../../"
    path = base_dir + "data/server/"
    cmd_exe = base_dir+"bin/crypto_128.exe"
    result = subprocess.run([cmd_exe, path+"key.txt",path+"t0_en",path+"t0"])

    if result.returncode != 0:
        return False
    result = subprocess.run([cmd_exe, path + "key.txt", path + "t1_en", path + "t1"] )

    if result.returncode != 0:
        return False
    return True

if __name__ == '__main__':
    work()